-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose DeviceCommissioner::ComputePASEVerifier
to Obj-C.
#22112
Expose DeviceCommissioner::ComputePASEVerifier
to Obj-C.
#22112
Conversation
PR #22112: Size comparison from fee403e to bbb9322 Increases (4 builds for bl602, psoc6, telink)
Decreases (2 builds for esp32, psoc6)
Full report (32 builds for bl602, cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, telink)
|
bbb9322
to
9ec86f2
Compare
9ec86f2
to
eded3be
Compare
PR #22112: Size comparison from 82d974b to a06578d Increases (2 builds for cc13x2_26x2, psoc6)
Decreases (4 builds for bl602, cc13x2_26x2, psoc6, telink)
Full report (32 builds for bl602, cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, telink)
|
if (![self isRunning]) { | ||
[self checkForError:errorCode logMsg:kErrorNotRunning error:nil]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use checkIsRunning.
|
||
__block NSData * result; | ||
__block chip::Spake2pVerifier paseVerifier; | ||
__block chip::ByteSpan saltByteSpan = chip::ByteSpan(static_cast<const uint8_t *>(salt.bytes), salt.length); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use AsByteSpan()
.
dispatch_sync(_chipWorkQueue, ^{ | ||
if ([self isRunning]) { | ||
errorCode = self.cppCommissioner->ComputePASEVerifier(iterations, setupPincode, saltByteSpan, paseVerifier); | ||
MTR_LOG_ERROR("ComputePaseVerifier: %s", chip::ErrorStr(errorCode)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And if this fails... now what? We return garbage?
memcpy(serializedVerifier, paseVerifier.mW0, chip::kSpake2p_WS_Length); | ||
memcpy(&serializedVerifier[sizeof(paseVerifier.mW0)], paseVerifier.mL, sizeof(paseVerifier.mL)); | ||
|
||
result = [NSData dataWithBytes:serializedVerifier length:sizeof(serializedVerifier)]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use AsData()
.
Also, why is this API on MTRDeviceController instances at all? It does not use any instance state, either in practice or conceptually. In the SDK API it's an instance API on DeviceCommissioner, but that's also an odd API choice and we should not be propagating it into the Darwin framework. |
…hip#22112) * Expose `DeviceCommissioner::ComputePASEVerifier` to Obj-C. * Restyled by whitespace * Restyled by clang-format Co-authored-by: Restyled.io <[email protected]>
Problem
DeviceCommissioner::ComputePASEVerifier
to Obj-C.Change overview
Added function
computePaseVerifier:iterations:salt:
toMTRDeviceController
to exposeDeviceCommissioner ::ComputePASEVerifier
to Obj-C.